<template>
	<view class="plr15">
		<view class="artItem posRelative mb15  ">
			<view class="align-center justify-between">
				<image src="/static/images/f.png" mode=""></image>
				<view class="right flex1">
					<view class="align-center justify-between ">
						<view class="align-center">
							<view class="name">
								{{i.realname}}
							</view>
							<text class="tag">会员</text>
						</view>

						<!-- <view class="" style="color: #3d3d3d;">
							已成功对接 <text style="color: #3662EC;font-weight: 500;"> 3 </text>次 被查看  <text style="color: #3662EC;font-weight: 500;">56</text>  次
						</view> -->
					</view>
					<view class="desc">
						{{i.company}} | {{i.career}}
					</view>
				</view>
			</view>
			<view class=" mt16 align-center justify-start flex-wrap">
				<view class="tags">
					{{i.classname}}
				</view>

			</view>
			<view class="justify-end">
				<view class="collect  justify-center" @click="collect">
					<uv-icon name="star"></uv-icon> 收藏
				</view>
			</view>

		</view>
		<view class="partnerdata  mt20 ft15 align-center">
			<text class="shu"></text>
			<text>公司简介：</text>
			<view class="clamp1 jointype ml15" style="">
				{{i.company_profile}}
			</view>
		</view>
		<view class="partnerdata  mt20 ft15 align-center">
			<text class="shu"></text>
			<text>布局城市：</text>
			<view class="clamp1 jointype ml15" style="">
				{{i.layout_city}}
			</view>
		</view>
		<view class="partnerdata mt15 ft15 align-center">
			<text class="shu"></text>
			<text>合作需求：</text>
			<view class="clamp1 jointype ml15" style="">
				{{i.business_type}}
			</view>
		</view>
		<view class="notice align-center justify-center flex-col" style="padding: 0 64rpx;">
			<uv-icon name="info-circle" color="#FF8F1F" size="26"></uv-icon>
			<view class="mt10">
				以上信息由会员本人提交, 平台无法保证信息100%真实，商务合作请自主谨慎判断!
			</view>
		</view>

		<view class="justify-between align-center paybtn">
			<view @click="pay" class="onlinePay">{{isVip? '立即对接':"成为会员，立即对接"}}  </view>
		</view>
		<uv-popup ref="popup" :bgColor="none" :closeable="true">
			<view class="popcontent posRelative flex-col justify-center align-center">

				<view class="poptitle">
					提示
				</view>
				<view class="flex1 align-center">
					成为会员才可查看!
				</view>
				<view class="tobuy" @click="toBuy">
					购买会员
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	export default {
		props: {
			datas: {
				type: Array,
				default: [],
				
			}
		},
		data() {
			return {
				i: {},
				id: "",
				isVip:false

			};
		},
		onLoad(opt) {
			if (opt.id) this.id = opt.id
			this.getInfo()
		},
		onShow() {

		},
		methods: {
			collect() {
				this.$api.savecollect({
					categoryId: 1,
					userId: uni.getStorageSync('userId'),
					itemId: this.id
				}).then(res => {
					console.log(res)
					uni.showToast({
						title: '收藏成功'
					})
				})
			},
			formateTime(data) {
				return this.$utils.formatDateTime(data)
			},
			getInfo() {
				this.$api.companyDetails({
					id: this.id
				}).then(res => {
					console.log(res)
					this.i = res.data
				})
				this.$api.checkExpired({userId: uni.getStorageSync('userId'),}).then(res=>{
					if(res.code==200){
						this.isVip=true
						
					}else{
						this.isVip=false
					}
				})
			},
			toBuy(){
				uni.navigateTo({
					url:'/pages/vipApply/index'
				})
			},
			pay() {
					
				if(this.isVip){
					this.$api.connect({
						from_user_id: uni.getStorageSync('userId'),
						to_user_id:this.id
					}).then(res=>{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					})
				}else{
					this.$refs.popup.open()
				}
				
				
			}

		}
	}
</script>

<style lang="scss" scoped>
	.artItem {

		border-bottom: 2rpx solid #D8D8D8;
		margin-bottom: 40rpx;
		padding-bottom: 42rpx;
		font-size: 24rpx;
		color: #666666;

		image {
			width: 96rpx;
			height: 96rpx;
			margin-right: 30rpx;
			flex-shrink: 0;
		}

		.name {
			font-weight: 500;
			font-size: 30rpx;
			color: #3D3D3D;
		}

		.right {
			width: 422rpx;

			image {
				width: 28rpx;
				margin: 0 4rpx 0 0;
			}

			.name {
				font-weight: 700;
				font-size: 28rpx;
				color: #3D3D3D;
				margin-right: 22rpx;
			}
		}

		.tag {
			width: 82rpx;
			height: 40rpx;
			background: #FF0000;
			border-radius: 60rpx 60rpx 60rpx 60rpx;
			text-align: center;
			font-size: 28rpx;
			color: #fff;
			display: block;
		}

		.desc {
			margin-top: 10rpx;
			line-height: 32rpx;
		}
	}

	.mt16 {
		margin-top: 32rpx;
	}

	.tags {
		padding: 10rpx 20rpx;
		border-radius: 60rpx;
		font-size: 28rpx;
		background: #FFBC47;
		letter-spacing: 2rpx;
		line-height: 28rpx;
		color: #fff;
		text-align: center;
	}

	.partnerdata {
		color: #3D3D3D;

		.shu {
			width: 6rpx;
			height: 40rpx;
			display: inline-block;
			margin-right: 28rpx;
			background: #0368FF;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
		}

	}

	.jointype {}

	.paybtn {

		position: fixed;
		bottom: 0;
		width: 100%;
		left: 0;
		background-color: #fff;
		font-size: 32rpx;
		color: #FFFFFF;


		.onlinePay {
			flex: 1;
			line-height: 94rpx;
			text-align: center;
			color: #fff;
			height: 94rpx;
			background: #0368FF;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
		}
	}

	.notice {
		margin-top: 140rpx;
		width: 690rpx;
		height: 238rpx;
		background: rgba(255, 143, 31, 0.05);
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		font-size: 28rpx;
		color: #3D3D3D;
		line-height: 44rpx;
	}

	.collect {
		border: 2rpx solid rgba(0, 0, 0, 0.1);
		display: inline-flex;
		width: 132rpx;
		height: 52rpx;
		border-radius: 60rpx;
		line-height: 52rpx;
	}

	.popcontent {
		width: 638rpx;
		height: 388rpx;
		background: #FFFFFF;
		font-size: 32rpx;
		color: #3D3D3D;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		text-align: center;

		.poptitle {
			height: 106rpx;
			line-height: 106rpx;
			width: 100%;
			border-bottom: 2rpx solid #D8D8D8;
		}

		.tobuy {
			height: 108rpx;
			background: #0368FF;
			border-radius: 0rpx 0rpx 24rpx 24rpx;
			width: 100%;
			color: #fff;
			line-height: 108rpx;

		}
	}
</style>